﻿@model object
@{
    ViewData.TemplateInfo.HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix.Replace(ViewData.ModelMetadata.PropertyName, "").Trim('.');
    var propertyName = ViewData["name"] == null ? ViewData.ModelMetadata.PropertyName : ViewData["name"].ToString();
    var isEditing = false;
    if (ViewBag.IsEditing != null)
    {
        isEditing = (bool)ViewBag.IsEditing;
    }
}
<tr>
    <td colspan="2">
        <label>
            @ViewData.ModelMetadata.GetDisplayName().Localize()</label>

        @Html.Partial("FolderTree", new Kooboo.CMS.Web.Areas.Contents.Models.FolderTreeModel() { InputName = ViewData.TemplateInfo.GetFullHtmlFieldName(propertyName), IsSingle = false, IsEditing = isEditing, InputAttributes = Html.GetUnobtrusiveValidationAttributes(propertyName, ViewData.ModelMetadata), Values = Model != null ? new List<string> { Model.ToString() } : new List<string>(), AllowNull = !ViewData.ModelMetadata.IsRequired })
        @Html.ValidationMessage(ViewData.ModelMetadata, new { name = ViewData["name"] })
        @if (!string.IsNullOrEmpty(ViewData.ModelMetadata.Description))
        {
            <em class="tip">@(ViewData.ModelMetadata.Description.Localize())</em>
        }
    </td>
</tr>
